import {onMounted, ref} from 'vue'
import {getSerActivityRict} from '@/api/SerActivity'
// 活动管理状态
export const PicState=()=>{
  let stateList=[
    {label:'无效',value:1},
    {label:'有效',value:0}
  ]
  return stateList
}
export const PicCateAllList=()=>{
  const cateList=ref([])
  const getSerActivityRic=async()=>{
    let {data}=await getSerActivityRict()
    cateList.value=data
  }
  onMounted(() => {
    getSerActivityRic()
  })
  return cateList
}
// 时间戳变年月日时分秒
export const formatTimestamp=(timestamp)=>{
    const date = new Date(timestamp);

    const year = date.getFullYear();
    const month = (date.getMonth() + 1).toString().padStart(2, '0');
    const day = date.getDate().toString().padStart(2, '0');
    const hours = date.getHours().toString().padStart(2, '0');
    const minutes = date.getMinutes().toString().padStart(2, '0');
    const seconds = date.getSeconds().toString().padStart(2, '0');

    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  }
  export const RepState=()=>{
    let RepstateList=[
      {label:'待受理',value:0},
      {label:'已受理',value:1},
      {label:'已维修',value:2}
    ]
    return RepstateList
  }
  // 投诉管理下拉框
  export const complainState=()=>{
    let complainstateList=[
      {label:'不匿名',value:0},
      {label:'匿名',value:1}
     
    ]
    return complainstateList
  }
  // 信箱管理下拉框
  export const MailboxState=()=>{
    let MailboxstateList=[
      {label:'未读',value:0},
      {label:'已读回复',value:1}
     
    ]
    return MailboxstateList
  }
  // 投票管理类型
  export const ticketState=()=>{
    let ticketstateList=[
      {label:'单选',value:0},
      {label:'多选择',value:1}
     
    ]
    return ticketstateList
  }
  export const TicketState=()=>{
    let TicketstateList=[
      {label:'关闭',value:0},
      {label:'开启',value:1}
     
    ]
    return TicketstateList
  }
  // 弹窗显示
export const HdisShow=ref(false)
export const BxisShow=ref(false)
export const TsisShow=ref(false)
export const XXisShow=ref(false)
export const TPisShow=ref(false)


// ========= 年 月 日 - 时 分 秒=======
export const formatTimeAll = timestamp => {
  const date = new Date(timestamp);

  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  const formatNumber = n => {
    n = n.toString()
    return n[1] ? n : `0${n}`
  }
  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
